package com.albert.model;

import com.albert.tool.CameraActionType;
import com.albert.tool.CarActionType;

import lombok.Getter;
import lombok.Setter;

public class OperateCarModel extends BaseModel {

    @Getter
    @Setter
    Boolean leftRotate;
    @Getter
    @Setter
    Boolean leftSlide;
    @Getter
    @Setter
    Boolean rightRotate;
    @Getter
    @Setter
    Boolean rightSlide;
    @Getter
    @Setter
    Float percentX;
    @Getter
    @Setter
    Float percentY;

    // 左旋 左移  右旋  右移
    public OperateCarModel(CarActionType carActionType, boolean isPressed) {
        switch (carActionType) {
            case CAR_ACTION_LEFT_ROTATE:
                this.leftRotate = isPressed;
                break;
            case CAR_ACTION_LEFT_SLIDE:
                this.leftSlide = isPressed;
                break;
            case CAR_ACTION_RIGHT_ROTATE:
                this.rightRotate = isPressed;
                break;
            case CAR_ACTION_RIGHT_SLIDE:
                this.rightSlide = isPressed;
                break;
        }
    }

    public OperateCarModel(int percentX, int percentY) {
        this.percentX = (float) (percentX / 100.0);
        this.percentY = (float) (percentY / 100.0);
    }
}
